package com.ruoyi.bizsys.controller;

import java.util.List;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bizsys.domain.CustBvnMatch;
import com.ruoyi.bizsys.service.ICustBvnMatchService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * BVN Match
 * Controller
 *
 * @author african-loan
 * @date 2021-12-30
 */
@RestController
@RequestMapping("/bizsys/cust_bvn_match")
public class CustBvnMatchController extends BaseController {
    @Autowired
    private ICustBvnMatchService custBvnMatchService;

    /**
     * 查询BVN Match
     * 列表
     */
    @PreAuthorize("@ss.hasPermi('bizsys:cust_bvn_match:list')")
    @GetMapping("/list")
    public TableDataInfo list(CustBvnMatch custBvnMatch) {
        startPage();
        List<CustBvnMatch> list = custBvnMatchService.selectCustBvnMatchList(custBvnMatch);
        return getDataTable(list);
    }

    /**
     * 导出BVN Match列表
     */
    @PreAuthorize("@ss.hasPermi('bizsys:cust_bvn_match:export')")
    @Log(title = "BVN Match", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(CustBvnMatch custBvnMatch) {
        List<CustBvnMatch> list = custBvnMatchService.selectCustBvnMatchList(custBvnMatch);
        ExcelUtil<CustBvnMatch> util = new ExcelUtil<CustBvnMatch>(CustBvnMatch.class);
        return util.exportExcel(list, "cust_bvn_match");
    }

    /**
     * 获取BVN Match
     * 详细信息
     */
    @PreAuthorize("@ss.hasPermi('bizsys:cust_bvn_match:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(custBvnMatchService.selectCustBvnMatchById(id));
    }

    /**
     * 新增BVN Match
     */
    @PreAuthorize("@ss.hasPermi('bizsys:cust_bvn_match:add')")
    @Log(title = "BVN Match", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CustBvnMatch custBvnMatch) {
        return toAjax(custBvnMatchService.insertCustBvnMatch(custBvnMatch));
    }

    /**
     * 修改BVN Match
     */
    @PreAuthorize("@ss.hasPermi('bizsys:cust_bvn_match:edit')")
    @Log(title = "BVN Match ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CustBvnMatch custBvnMatch) {
        return toAjax(custBvnMatchService.updateCustBvnMatch(custBvnMatch));
    }

    /**
     * 删除BVN Match

     */
    @PreAuthorize("@ss.hasPermi('bizsys:cust_bvn_match:remove')")
    @Log(title = "BVN Match ", businessType = BusinessType.DELETE)
            @DeleteMapping("/{ids}")
            public AjaxResult remove(@PathVariable Long[]ids) {
        return toAjax(custBvnMatchService.deleteCustBvnMatchByIds(ids));
    }
}
